//
//  FSCClassRoomController.swift
//  FamiliesSchoolConnection
//
//  Created by 花花蔡 on 2016/12/22.
//  Copyright © 2016年 com.HuaHuaCai. All rights reserved.
//

import UIKit

import SVProgressHUD

class FSCClassRoomController: UITableViewController {

    let FSCClassRoomListVM = FSCClassRoomListViewModel()
    
    override func viewDidLoad() {
        super.viewDidLoad()

        tableView.register(UINib.init(nibName: "FSCClassRoomCell", bundle: nil), forCellReuseIdentifier: "classRoomCell")
        tableView.rowHeight = 110 * KWidth_ScaleW
        
        downLoadData()
        
    }
    
    //加载数据
    func downLoadData() -> Void {
        FSCClassRoomListVM.loadData { [weak self](isOk) in
            if isOk {
                self?.tableView.reloadData()
            }
        }
    }
    
   
}


// MARK: - Table view data source

extension FSCClassRoomController {
    
    
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
       
        return FSCClassRoomListVM.classRoomModelArr.count
    }
    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "classRoomCell", for: indexPath) as! FSCClassRoomCell
        let model = FSCClassRoomListVM.classRoomModelArr[indexPath.row]
        cell.model = model
        
        return cell
    }

}
